<?php
/**
 * LowCalVanilla Functions
 *
 * @package Extensions
 * @subpackage Low-Cal_Vanilla
 * @copyright Damien Lebrun 2007
 * @author Damien Lebrun
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GPLv2
 */


/**
 * Sniff for IE 5.5 and IE6; some version have issue with gzip content
 * @param bool $ResponseForNoInfo What to return if USER_AGENT is not set
 * @return bool Return true if you cannot believe Accept-Encoding
 * @uses $_SERVER['HTTP_USER_AGENT']
 * @link http://support.microsoft.com/kb/321722/EN-US/
 * @link http://support.microsoft.com/default.aspx?scid=kb;[LN];Q312496
 */
function IsGzipIncompatibleClient($ResponseForNoInfo = true) {

	// return if $_SERVER['HTTP_USER_AGENT'] is not set
	if (!isset($_SERVER['HTTP_USER_AGENT'])
	|| empty($_SERVER['HTTP_USER_AGENT'])
	) {
		return $ResponseForNoInfo;
	}

	// check for IE5.5 all version, IE6.0 and IE6.0 sp1
	$UserAgent = $_SERVER['HTTP_USER_AGENT'];
	if (preg_match('/MSIE (5\.5|6\.0(?!.*\bSV1\b))/i', $UserAgent)) {
		return true;
	}
	return false;
}

/**
 * Add Low-Cal vanilla settings to conf/settings.php (no settings yet).
 * @param Context $Context Vanilla context object
 * @return void
 */
function InstallLowCalVanilla(&$Context) {
	if (!array_key_exists('LOWCALVANILLA_VERSION', $Context->Configuration)) {
		AddConfigurationSetting($Context, 'LOWCALVANILLA_VERSION', '0.2.0');
	}
}